package com.zues.thread.design_mode.enjoy_yuan;

import com.zues.thread.util.ThreadUtil;

import java.sql.Connection;

/**
 * @author zues
 * @date 3/18/2025 9:19 下午
 */
public class Demo1 {

    //测试自定义连接池
    public static void main(String[] args) {
        Pool pool = new Pool(2);
        for (int i = 0; i < 5; i++) {
            new Thread(()->{
                Connection borrow = pool.borrow();
                ThreadUtil.sleep(1);
                pool.free(borrow);
            }).start();
        }
    }


}
